package org.dandsoft.blackbox.mapreduce.data;

import org.dandsoft.blackbox.mapreduce.data.ValueIterator;

import java.util.Iterator;
import java.util.Collection;

/**
 * @author Vilyuzhanin Denis (Fin)
 */
public class CollectionValueIterator implements ValueIterator {

    private Iterator iterator;
    private int size;

    public CollectionValueIterator(Collection collection) {
        this.iterator = collection.iterator();
        this.size = collection.size();
    }

    public boolean hasNext() {
        return iterator.hasNext();
    }

    public Object next() {
        if (hasNext()) {
            return iterator.next();
        } else {
            return null;
        }
    }

    public int getSize() {
        return this.size;
    }

    public boolean isDataRedy() {
        return true;
    }

    public void waitForData() {

    }
}
